const mongoose = require('mongoose');

// 定义用户模型的 Schema
const userSchema = new mongoose.Schema({
    account: { type: String, required: true, unique: true },
    nickname: { type: String, required: true },
    password: { type: String, required: true },
    age: { type: Number },
    sex: { type: String },
    phone: { type: String, unique: true },
    email: { type: String, required: true, unique: true },
    isAdmin: { type: Boolean, default: false },
    createdAt: { type: Date, default: Date.now } // 添加创建时间字段
});

// 创建并导出用户模型
const User = mongoose.model('user', userSchema);
module.exports = User;